<?
session_start();
$pagename=LA_NEW_PASS1;
include_once("header_inc.php");
include_once("member_header.php");
check_valid_user("");
$valid_user = $_SESSION["valid_user"];
$tplChangePass=new TplLoad;

$n_pass1=getParam("n_pass1","");
$n_pass2=getParam("n_pass2","");

if (getParam("submit",""))
{
	if (ereg(" ", $n_pass1) || strlen($n_pass1)<$set_password_len)
		$tplChangePass->assign("change",3);
	elseif ($n_pass1 == $n_pass2)
	{
  		$result = q ("update $usr_tbl set user_pass_md5 = md5('$n_pass1') where user_id = '".$_SESSION["valid_user"]."'");
			if ($result)
				$tplChangePass->assign("change",1);
	}
	else
		$tplChangePass->assign("change",2);
		
	addToHistory(15,$_SESSION["valid_user"],"","");
}
$tplChangePass->assign("la_pass",eregi_replace("%1%",$set_password_len,LA_PASS1));
$tplChangePass->assign("error_24",eregi_replace("%1%",$set_password_len,LA_ERROR_MSG24));
$tplChangePass->display("member_changepass.tpl");
include_once("member_footer.php");
include_once("footer_inc.php");
?>
